{% extends 'base.html' %}
{% load static %}
{% block 'title' %}确认订单{% endblock%}
{% block 'header-title' %}确认订单{% endblock%}
{% block 'content' %}
<div class="container">
    
    {% include 'widget-search.html'%}
    
    
    <form method="post">
        {% csrf_token %}
        <div class="form-group row">
            <div class="input-group mb-2">
                <div class="input-group-prepend">
                  <div class="input-group-text">收货地址</div>
                </div>
                <select name="address" class="form-control"  required>
                    {% for add in address%}
                    <option value="{{add.pk}}">{{add.location}}&MediumSpace;{{add.detail}}</option>
                    {% endfor %}
                </select>
                <a class="btn btn-link" href="{% url 'address' %}">管理</a>
            </div>
        </div>
        <div class="alert alert-success" role="alert">
            订单总额：${{total}}
        </div>
        <div class="table-responsive">
            <table class="table  table-hover">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>名称</th>
                        <th>价格</th>
                        <th>数量</th>
                        <th>总价</th>
                    </tr>
                </thead>
                <tbody>
                    {% for item in paginator %}
                    <tr>
                        <td>{{forloop.counter0|add:paginator.start_index}}</td>
                        <td><a href="{% url 'show' item.product.pk %}">{{item.title}}</a></td>
                        <td>${{item.price}}</td>
                        <td>{{item.counts}}</td>
                        <td>${{item.total}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% include 'widget-paginator.html' %}
            {% include 'message.html' %}
            <p class="btn-toolbar pull-right" style="float: right;">
                <button type="submit" class="btn btn-outline-success mr-3">确认订单</button>
                <a class="btn btn-outline-danger" href="{% url 'cart'  %}">取消</a>
            </p>
        </div>
    </form>
</div>
{% endblock %}